﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Data.Core.UoW
{
    public interface ITransaction : IDisposable
    {
        /// <summary>
        /// Event raised when the transaction has been comitted.
        /// </summary>
        event EventHandler TransactionCommitted;

        /// <summary>
        /// Event raised when the transaction has been rolledback.
        /// </summary>
        event EventHandler TransactionRolledback;

        /// <summary>
        /// Commits the changes made to the data store.
        /// </summary>
        /// <remarks>Implementors MUST raise the <see cref="TransactionCommitted"/> event.</remarks>
        void Commit();

        /// <summary>
        /// Rollsback any changes made.
        /// </summary>
        /// <remarks>Implementors MUST raise the <see cref="TransactionRolledback"/> event.</remarks>
        void Rollback();
    }
}
